import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Form, Input, Button, Select, Radio, Col, Row, Card, Upload, Icon, DatePicker, Tooltip } from 'antd';
import router from 'umi/router';
import { message } from 'antd/lib/index';

import styles from './style.less';
import { baseUrl } from '@/utils/config';
import { listed } from '../../../../common/selectOption';
import * as options from '../../../../common/selectOption';
import moment from 'moment';

require('./pic.css');
const { Option } = Select;
const { TextArea } = Input;
const RadioGroup = Radio.Group;

const formItemLayout = {
  labelCol: {
    span: 7,
  },
  wrapperCol: {
    span: 17,
  },
};


@connect(({ packing }) => ({
  packing,
}))
@Form.create()
class Packing extends React.PureComponent {


  constructor(props) {
    super(props);
    const { type } = props;

    this.state = {
      status: false,
      fileList: [],
      disabled: type === 'view',
    };
  }


  componentWillMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'packing/merchantList',
    });
  }

  componentWillReceiveProps(nextProps) {
    const { packing: { uploadData }, type } = nextProps;
    if (uploadData.length > 0) {
      this.setState({
        fileList: uploadData,
      });
    } else {
      this.setState({
        fileList: [],
      });
    }
  }

  handleChange = (info) => {
    const { dispatch } = this.props;
    info = info.map((file) => {
      if (file.response) {
        file.url = file.response.url;
      }
      return file;
    });

    info = info.filter((file) => {
      if (file.response) {
        return file.response.status === 'success';
      }
      return true;
    });
    dispatch({
      type: 'packing/uploadData',
      payload: info,
    });
  };
  customRequest = (componentsData) => {
    let _this = this;
    const { dispatch } = this.props;
    let originFile = componentsData.file;
    const formData = new FormData();
    formData.append('multipartFile', originFile);
    formData.append('name', originFile.name);
    formData.append('uid', originFile.uid);
    dispatch({
      type: 'packing/upload',
      payload: formData,
      callback(res) {
        const { fileList } = _this.state;
        if (res.code === 200) {
          let obj = {
            ...res.msg,
          };
          _this.handleChange([...fileList, obj]);
        }
      },
    });
  };
  onRemove = (e) => {
    const { fileList } = this.state;
    let dataArr = JSON.parse(JSON.stringify(fileList));
    dataArr.map((item, index) => {
      if (item.uid === e.uid) {
        dataArr.splice(index, 1);
      }
    });
    this.setState({
      fileList: dataArr,
    });
  };

  render() {
    const { form, dispatch, packing: { merchantLists }, type, obj } = this.props;
    const { fileList, disabled } = this.state;

    const { getFieldDecorator, validateFields } = form;
    const goBack = () => {
      router.goBack();
    };
    const onValidateForm = () => {
      let str = '';
      fileList.map((item) => {
        str = str + ',' + item.url;
      });
      validateFields((err, values) => {
        if (err) return;

        values.relateData = str;
        values.enterpriseBorrower.buildTime = values.enterpriseBorrower.buildTime ? moment(values.enterpriseBorrower.buildTime).format('YYYY-MM-DD') : '';
        values.borrowerIndustry = 1;
        values.enterpriseBorrower.borrowerIndustry = 1;
        values.safeGuard = '1、升值空间风控团队实地走访尽调；\n' +
          '2、全方位多维度核查借款人及其项目信息；\n' +
          '3、核实资金用途；\n' +
          '4、常规贷后定期走访，及时预警';
        values.projectNo = obj.projectNo;
        values.raiseDate = '14天';
        dispatch({
          type: 'packing/put',
          payload: values,
          callback(res) {
            if (res.code === 200) {
              message.success('包装成功');
              router.push('/app/project');
            } else {
              message.error(res.errMsg);
            }
          },
        });

      });
    };
    const onEditForm = () => {
      let str = '';
      if (fileList.length > 0) {
        fileList.map((item) => {
          str += item.url + ',';
        });
      }
      validateFields((err, values) => {
        if (err) return;
        values.safeGuard = '1、升值空间风控团队实地走访尽调；\n' +
          '2、全方位多维度核查借款人及其项目信息；\n' +
          '3、核实资金用途；\n' +
          '4、常规贷后定期走访，及时预警';
        values.projectNo = obj.projectNo;
        values.enterpriseBorrower.buildTime = values.enterpriseBorrower.buildTime ? moment(values.enterpriseBorrower.buildTime).format('YYYY-MM-DD') : '';
        values.borrowerIndustry = 1;
        values.enterpriseBorrower.borrowerIndustry = 1;
        values.relateData = str;
        dispatch({
          type: 'packing/edit',
          payload: values,
          callback(res) {
            if (res.code === 200) {
              message.success('编辑成功');
              router.push('/app/project');
            } else {
              message.error(res.errMsg);
            }
          },
        });
      });
    };
    const resetForm = () => {
      this.props.form.resetFields();
      this.setState({ fileList: [] });

    };
    const riskLevelA = [{
      key: 1,
      value: 'AAA',
    }, {
      key: 2,
      value: 'AA',
    }, {
      key: 3,
      value: 'A',
    }];
    const riskLevelB = [{
      key: 1,
      value: 'BBB',
    }, {
      key: 2,
      value: 'BB',
    }, {
      key: 3,
      value: 'B',
    }];
    const riskLevelC = [{
      key: 1,
      value: 'CCC',
    }, {
      key: 2,
      value: 'CC',
    }, {
      key: 3,
      value: 'C',
    }];
    let selectRiskLevel = [];
    let level = form.getFieldValue('risk') || obj.risk;
    if (level === 1) {
      selectRiskLevel = riskLevelA;
    } else if (level === 2) {
      selectRiskLevel = riskLevelB;
    } else if (level === 3) {
      selectRiskLevel = riskLevelC;
    }
    const propss = {
      action: `/img/upload`,
      onRemove: this.onRemove,
      showUploadList: { showPreviewIcon: true, showRemoveIcon: !disabled },

      multiple: true,
      customRequest: this.customRequest,
      listType: 'picture-card',
      className: 'upload-list-inline',
    };
    return [
      <Form layout="horizontal">
        {
          obj ?
            [
              <Card title="借款人基本信息" bordered={false} style={{ marginBottom: 20 }}>
                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.step1Form}>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="借款人类型">
                      {getFieldDecorator('enterpriseBorrower.borrowType', {
                        initialValue: obj.borrowType,
                        rules: [{ required: true, message: '请选择借款人类型' }],
                      })(
                        <Select placeholder="请选择借款人类型" disabled={disabled}>
                          {options.enterpriseNature.map((item) => (
                            <Option key={item.key} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="借款企业">
                      {getFieldDecorator('enterpriseBorrower.enterpriseName', {
                        initialValue: obj.enterpriseName,
                        rules: [{ required: true, message: '请输入借款企业' }],
                      })(<Input disabled={disabled} placeholder="请输入借款企业"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="社会信用代码">
                      {getFieldDecorator('enterpriseBorrower.creditCode', {
                        initialValue: obj.creditCode,
                        rules: [{ required: false, message: '请输入社会信用代码' }],
                      })(
                        <Input disabled={disabled} placeholder="请输入统一社会信用代码"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="法定代表人">
                      {getFieldDecorator('enterpriseBorrower.legal', {
                        initialValue: obj.legal,
                        rules: [{ required: true, message: '请填写法定代表人' }],
                      })(
                        <Input disabled={disabled} placeholder="请填写法定代表人"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="经营范围">
                      {getFieldDecorator('enterpriseBorrower.scope', {
                        initialValue: obj.scope,
                        rules: [{ required: false, message: '请填写经营范围' }],
                      })(
                        <Input disabled={disabled} placeholder="请填写经营范围"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="注册资本(万)">
                      {getFieldDecorator('enterpriseBorrower.capital', {
                        initialValue: obj.capital,
                        rules: [{ required: true, message: '请填写注册资本' }],
                      })(
                        <Input disabled={disabled} placeholder="请填写注册资本"/>,
                      )}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="成立时间">
                      {getFieldDecorator('enterpriseBorrower.buildTime', {
                        initialValue: obj.buildTime ? moment(obj.buildTime) : '',
                        rules: [{ required: false, message: '请选择成立时间' }],
                      })(
                        <DatePicker disabled={disabled} placeholder='请选择成立时间' style={{ width: '100%' }}/>,
                      )}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="注册地址">
                      {getFieldDecorator('enterpriseBorrower.address', {
                        initialValue: obj.address,
                        rules: [{ required: true, message: '请填写注册地址' }],
                      })(
                        <Input disabled={disabled} placeholder="请填写注册地址"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="办公地址">
                      {getFieldDecorator('enterpriseBorrower.workSpace', {
                        initialValue: obj.workSpace,
                        rules: [{ required: false, message: '请填写办公地址' }],
                      })(
                        <Input disabled={disabled} placeholder="请填写办公地址"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="主营业务">
                      {getFieldDecorator('enterpriseBorrower.operation', {
                        initialValue: obj.operation,
                        rules: [{ required: true, message: '请输入主营业务' }],
                      })(
                        <Input disabled={disabled} placeholder="请输入主营业务"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="经营区域">
                      {getFieldDecorator('enterpriseBorrower.managementArea', {
                        initialValue: obj.managementArea,
                        rules: [{ required: false, message: '请输入经营区域' }],
                      })(
                        <Input disabled={disabled} placeholder="请输入经营区域"/>,
                      )}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="从业年限">
                      {getFieldDecorator('enterpriseBorrower.entirePeriod', {
                        initialValue: obj.entirePeriod,
                        rules: [{ required: false, message: '请输入从业年限' }],
                      })(
                        <Input disabled={disabled} placeholder="请输入从业年限"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="股东信息">
                      {getFieldDecorator('enterpriseBorrower.shareHolder', {
                        initialValue: obj.shareHolder,
                        rules: [{ required: false, message: '请输入股东信息' }],
                      })(
                        <Input disabled={disabled} placeholder="请输入股东信息"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="所属行业">
                      {getFieldDecorator('enterpriseBorrower.industry', {
                        initialValue: obj.industry,
                        rules: [{ required: true, message: '请选择借款人所属行业' }],
                      })(
                        <Select placeholder="请选择借款人所属行业" disabled={disabled}>
                          {options.borrowerIndustry.map((item) => (
                            <Option key={item.key} value={item.value}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                </Row>
              </Card>,
              <Card title="借款人在平台借款情况" bordered={false} style={{ marginBottom: 20 }}>
                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.step1Form}>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="累计借款笔数	">
                      {getFieldDecorator('enterpriseBorrower.borrowTimes', {
                        initialValue: obj.borrowTimes,
                        rules: [{ required: true, message: '请输入累计借款笔数' }],
                      })(<Input disabled={disabled} placeholder="请输入累计借款笔数"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="累计借款金额	">
                      {getFieldDecorator('enterpriseBorrower.borrowAmount', {
                        initialValue: obj.borrowAmount,
                        rules: [{ required: true, message: '请输入累计借款金额' }],
                      })(<Input disabled={disabled} placeholder="请输入累计借款金额"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="累计逾期金额">
                      {getFieldDecorator('enterpriseBorrower.overdueAmount', {
                        initialValue: obj.overdueAmount,
                        rules: [{ required: true, message: '请输入累计逾期金额' }],
                      })(<Input disabled={disabled} placeholder="请输入累计逾期金额"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="累计逾期次数">
                      {getFieldDecorator('enterpriseBorrower.overdueTimes', {
                        initialValue: obj.overdueTimes,
                        rules: [{ required: true, message: '请输入累计逾期次数' }],
                      })(<Input disabled={disabled} placeholder="请输入累计逾期次数"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="待还金额">
                      {getFieldDecorator('enterpriseBorrower.repaymentAmount', {
                        initialValue: obj.repaymentAmount,
                        rules: [{ required: true, message: '请输入待还金额' }],
                      })(<Input disabled={disabled} placeholder="请输入待还金额"/>)}
                    </Form.Item>
                  </Col>
                </Row>
                <Row className={styles.step1Form} gutter={{ md: 8, lg: 24, xl: 48 }}>

                  <Col md={24} sm={24}>
                    <Form.Item label="在其他网络借贷平台借款情况">
                      {getFieldDecorator('enterpriseBorrower.other', {
                        initialValue: obj.other,
                        rules: [{ required: true, message: '请输入在其他网络借贷平台借款情况' }],
                      })(<TextArea disabled={disabled} rows={4} placeholder="请输入在其他网络借贷平台借款情况"/>,
                      )}
                    </Form.Item>
                  </Col>
                </Row>
              </Card>,
              <Card title="基础信息" bordered={false} style={{ marginBottom: 20 }}>
                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.step1Form}>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="还款来源">
                      {getFieldDecorator('repaySource', {
                        initialValue: obj.repaySource,
                        rules: [{ required: true, message: '请输入还款来源' }],
                      })(<Input disabled={disabled} placeholder="请输入还款来源"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label='相关费用'>
                      {getFieldDecorator('relateFee', {
                        initialValue: '无认购费、管理费，收取债权转让费',
                        rules: [{ required: true, message: '请输入相关费用' }],
                      })(<Input disabled={true} placeholder="无认购费、管理费，收取债权转让费"/>)}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>
                    {merchantLists ?
                      <Form.Item {...formItemLayout} label="商户名称">
                        {getFieldDecorator('merchantNo', {
                          initialValue: obj.merchantNo,
                          rules: [{ required: true, message: '请选择商户名称' }],
                        })(
                          <Select disabled={disabled} placeholder="请选择商户名称">
                            {merchantLists.map((item) => (
                              <Option key={item.merchantNo} value={item.merchantNo}>{item.merchantName}</Option>
                            ))
                            }
                          </Select>,
                        )}
                      </Form.Item>
                      : ''}

                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="标的名称">
                      {getFieldDecorator('projectNo', {
                        initialValue: obj.projectName,
                        rules: [{ required: true, message: '请选择标的名称' }],
                      })(
                        <Input disabled={true} placeholder="填写上标利息"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="标的属性">
                      {getFieldDecorator('type', {
                        initialValue: obj.type,
                        rules: [{ required: true, message: '请选择标的属性' }],
                      })(
                        <Select disabled={true} placeholder="请选择标的属性">
                          {options.projectType.map((item) => (
                            <Option key={item.key} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="计息方式">
                      {getFieldDecorator('interestType', {
                        initialValue: obj.interestType ? obj.interestType : 2,
                        rules: [{ required: true, message: '请选择计息方式' }],
                      })(
                        <Select placeholder="请选择计息方式" disabled={disabled}>
                          {options.interestType.map((item) => (
                            <Option key={item.key} disabled={item.disabled} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="借款用途">
                      {getFieldDecorator('loanUsage', {
                        initialValue: obj.loanUsage,
                        rules: [{ required: true, message: '请选择借款用途' }],
                      })(
                        <Select placeholder="请选择借款用途" disabled={disabled}>
                          {options.loanUsage.map((item) => (
                            <Option key={item.key} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="上标利息">
                      {getFieldDecorator('rate', {
                        initialValue: obj.rate,
                        rules: [{ required: false, message: '填写上标利息' }],
                      })(
                        <Input disabled={true} placeholder="填写上标利息"/>,
                      )}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="能否使用加息券">
                      {getFieldDecorator('coupon', {
                        initialValue: obj.coupon,
                        rules: [{ required: true, message: '请选择是否' }],
                      })(
                        <Select placeholder="请选择是否" disabled={disabled}>
                          {listed.map((item) => (
                            <Option key={item.key} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                  {
                    form.getFieldValue('coupon') === 1 ? '' : <Col md={12} sm={24}>
                      <Form.Item {...formItemLayout} label="加息点数">
                        {getFieldDecorator('otherRate', {
                          initialValue: obj.otherRate ? obj.otherRate * 100 : obj.otherRate,
                          rules: [{ required: true, message: '填写上加息' }],
                        })(
                          <Input disabled={disabled} placeholder="填写上加息"/>,
                        )}
                      </Form.Item>
                    </Col>
                  }
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="项目类型">
                      {getFieldDecorator('projectTag', {
                        initialValue: obj.projectTag === 0 ? 1 : obj.projectTag,
                        rules: [{ required: true, message: '请选择项目类型' }],
                      })(
                        <Select disabled={disabled} placeholder="请选择项目类型">
                          <Option key={1} value={1}>酒店</Option>
                          <Option key={2} value={2}>餐饮</Option>
                          <Option key={3} value={3}>供应链</Option>
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                </Row>
                <Row className={styles.step1Form} gutter={{ md: 8, lg: 24, xl: 48 }}>

                  <Col md={24} sm={24}>
                    <Form.Item label="项目简介">
                      {getFieldDecorator('projectIntroduce', {
                        initialValue: obj.projectIntroduce,
                        rules: [{ required: true, message: '请输入标的介绍' }],
                      })(<TextArea disabled={disabled} rows={4} placeholder="请输入标的介绍"/>,
                      )}
                    </Form.Item>
                  </Col>
                </Row>
              </Card>,
              <Card title="详情信息" bordered={false}>
                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.step1Form}>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="借款方">
                      {getFieldDecorator('borrowerName', {
                        initialValue: obj.borrowerName,
                        rules: [{ required: true, message: '请输入借款方' }],
                      })(<Input disabled={disabled} placeholder="请输入借款方"/>)}
                    </Form.Item>
                  </Col>

                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="主体性质">
                      {getFieldDecorator('borrowerNature', {
                        initialValue: obj.borrowerNature,
                        rules: [{ required: true, message: '请选择主体性质' }],
                      })(
                        <Select disabled={disabled} placeholder="请选择主体性质">
                          {options.borrowerNature.map((item) => (
                            <Option key={item.key} value={item.key}>{item.value}</Option>
                          ))}
                        </Select>,
                      )}
                    </Form.Item>
                  </Col>
                  {/*<Col md={12} sm={24}>*/}
                  {/*<Form.Item {...formItemLayout} label="所属行业">*/}
                  {/*{getFieldDecorator('borrowerIndustry', {*/}
                  {/*initialValue: obj.borrowerIndustry,*/}
                  {/*rules: [{ required: true, message: '请选择借款人所属行业' }],*/}
                  {/*})(*/}
                  {/*<Select disabled={disabled} placeholder="请选择借款人所属行业">*/}
                  {/*{options.borrowerIndustry.map((item) => (*/}
                  {/*<Option key={item.key} value={item.key}>{item.value}</Option>*/}
                  {/*))}*/}
                  {/*</Select>,*/}
                  {/*)}*/}
                  {/*</Form.Item>*/}
                  {/*</Col>*/}

                  <Col md={12} sm={24}>
                    <Form.Item {...formItemLayout} label="标的募集期" style={{ visibility: 'hidden' }}>
                      {getFieldDecorator('raiseDate', {
                        initialValue: obj.raiseDate,
                        rules: [{ required: true, message: '请输入借款人收入及负债情况' }],
                      })(<Input disabled={disabled} placeholder="本项目自2018年10月30日起募集，最长募集期20天。"/>)}
                    </Form.Item>
                  </Col>
                  <Col md={12} sm={24}>

                    <Form.Item {...formItemLayout} label="风险评估">
                      {getFieldDecorator('risk', {
                        initialValue: obj.risk,
                        rules: [{ required: true, message: '请输入借款人收入及负债情况' }],
                      })(
                        <RadioGroup disabled={disabled}>
                          <Radio key='0' value={1}>低风险</Radio>
                          <Radio key='1' value={2}>中风险</Radio>
                          <Radio key='2' value={3}>高风险</Radio>
                        </RadioGroup>,
                      )}
                    </Form.Item>
                  </Col>

                  {
                    selectRiskLevel.length > 0 ?
                      <Col md={12} sm={24}>
                        <Form.Item {...formItemLayout} label="风险等级">
                          {getFieldDecorator('riskLevel', {
                            initialValue: obj.riskLevel,
                            rules: [{ required: true, message: '请输入借款人收入及负债情况' }],
                          })(
                            <RadioGroup disabled={disabled}>
                              {
                                selectRiskLevel.map(item => (
                                  <Radio value={item.key} key={item.key}>{item.value}</Radio>
                                ))
                              }
                            </RadioGroup>,
                          )}
                        </Form.Item>
                      </Col>
                      : ''}
                </Row>

                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.packingrow}>
                  <Col md={24} sm={24}>

                    <Form.Item label="评测结果">
                      {getFieldDecorator('riskResult', {
                        initialValue: obj.riskResult,
                        rules: [{ required: true, message: '请输入评测结果' }],
                      })(
                        <TextArea disabled={disabled} rows={4} placeholder="借款人评测结果"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={24} sm={24}>

                    <Form.Item label="借款人收入及负债情况">
                      {getFieldDecorator('borrowerDebts', {
                        initialValue: obj.borrowerDebts,
                        rules: [{ required: true, message: '请输入借款人收入及负债情况' }],
                      })(
                        <TextArea disabled={disabled} rows={4} placeholder="借款人收入及负债情况"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={24} sm={24}>

                    <Form.Item label="截至借款前6个月内借款人征信报告中的逾期情况">
                      {getFieldDecorator('borrowerOverdue', {
                        initialValue: obj.borrowerOverdue,
                      })(
                        <TextArea disabled={disabled} rows={4} placeholder="截至借款前6个月内借款人征信报告中的逾期情况"/>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={24} sm={24}>

                    <Form.Item label="借款人披露在其他网络接待平台借款情况">
                      {getFieldDecorator('borrowerLoanPlatform', {
                        initialValue: obj.borrowerLoanPlatform,
                      })(
                        <TextArea disabled={disabled} rows={4} placeholder="借款人披露在其他网络接待平台借款情况"/>,
                      )}
                    </Form.Item>
                  </Col>

                </Row>


              </Card>,
              <Card title="相关材料" bordered={false} style={{ marginBottom: 20 }}>
                <Row gutter={{ md: 8, lg: 24, xl: 48 }} className={styles.packingrow}>
                  <Col md={24} sm={24}>

                    <Form.Item label="上传材料">
                      {getFieldDecorator('relateData', {
                        initialValue: obj.relateData,
                        rules: [{ required: false, message: '请上传材料' }],
                      })(
                        <Upload {...propss} fileList={fileList} disabled={disabled}>
                          {disabled ? '' : (<div><Icon type="upload"/> 上传</div>)}
                        </Upload>,
                      )}
                    </Form.Item>
                  </Col>
                  <Col md={24} sm={24}>

                    <Form.Item
                      wrapperCol={{
                        xs: { span: 24, offset: 0 },
                        sm: {
                          span: formItemLayout.wrapperCol.span,
                          offset: formItemLayout.labelCol.span,
                        },
                      }}
                      label=""
                    >
                      {type === 'edit' ?
                        [<Button style={{ marginRight: 8 }} onClick={() => resetForm()} type='danger'>
                          重置
                        </Button>,
                          <Button style={{ marginRight: 8 }} onClick={() => onEditForm()}>
                            修改完成
                          </Button>,
                        ] : ''}
                      {type === 'packing' ?
                        [<Button style={{ marginRight: 8 }} onClick={() => resetForm()} type='danger'>
                          重置
                        </Button>,
                          <Button style={{ marginRight: 8 }} onClick={() => onValidateForm()}>
                            包装完成
                          </Button>] : ''
                      }
                      {type === 'view' ?
                        [
                          <Button style={{ marginRight: 8 }} onClick={() => goBack()}>
                            返回
                          </Button>] : ''
                      }

                    </Form.Item>
                  </Col>
                </Row>
              </Card>,
            ] : ''
        }
      </Form>,

    ];
  }
}

export default Packing;
